<?php

use yii\helpers\Html;
use yii\widgets\Pjax;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;

$this->title = $playerModel->title;
$regularLangName = \Yii::$app->czaHelper->getRegularLangName();
// $messageName = $model->getMessageName();

?>
<style>
    .of {
        font-weight: bold;
        color: #a1c4fd
    }

    .poster {
        width: 100%;
        position: fixed;
        left: 0;
        bottom: 42px;
        background-color: #000000; /* IE6和部分IE7内核的浏览器(如QQ浏览器)下颜色被覆盖 */
        background-color: rgba(0, 0, 0, 0.2); /* IE6和部分IE7内核的浏览器(如QQ浏览器)会读懂，但解析为透明 */
        text-align: center;
        z-index: 99;
    }

    .poster a {
        width: 60%;
        margin: 10px;
    }

    .tips {
        text-align: center;
        font-size: 12px;
        color: red;
        margin-top: 15px;
    }

    .modal-body1 {
        padding: 10px !important;
    }

</style>

<div class="container-fluid" style="padding: 10px">

    <?= \frontend\widgets\DailyStart::widget(['activityModel' => $activity]) ?>

    <?= \frontend\widgets\Loading::widget([]) ?>

    <?php Pjax::begin(['id' => 'pjax-container',]) ?>

    <?= $this->render('content', ['playerModel' => $playerModel, 'activityModel' => $activity]) ?>

    <?php Pjax::end() ?>

    <div class="content" style="color: #ffffff">

        <h4 style="text-align: center;font-weight: bold"><?= Yii::t('app.c2', 'Activity Introduce') ?></h4>
        <?= $activity->content ?>
    </div>
</div>

<div class="poster">
    <?= \yii\helpers\Html::a(Yii::t('app.c2', 'Generate Poster'), '/poster/' . $playerModel->player_code, [
        'class' => 'btn btn-info'
    ]) ?>
</div>

<script type="application/javascript">
    wx.ready(function () {   //需在用户可能点击分享按钮前就先调用
        //shareData 参数记得为字符串类型
        var shareData = {
            title: '<?= $playerModel->title ?>',
            desc: '',//这里请特别注意是要去除html
            link: '<?= FRONTEND_BASE_URL . Yii::$app->request->url ?>',//域名必须JS安全域名
            imgUrl: '<?= $playerModel->getThumbnailUrl() ?>',
            success: function () {
                //$.post('/activity-share', {'id': '<?//= $activityModel->id ?>//',}, function (res) {
                //    console.log(1);
                //})
            },
            cancel: function () {
                console.log('cancel')
            }
        };

        if (wx.onMenuShareAppMessage) { //微信文档中提到这两个接口即将弃用，故判断
            wx.onMenuShareAppMessage(shareData);//1.0 分享到朋友
            wx.onMenuShareTimeline(shareData);//1.0分享到朋友圈
        } else {
            wx.updateAppMessageShareData(shareData);//1.4 分享到朋友
            wx.updateTimelineShareData(shareData);//1.4分享到朋友圈
        }

    });

</script>
